package net.wanho.controller;

import lombok.extern.slf4j.Slf4j;
import net.wanho.util.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.logging.Logger;

/**
 * Author：汤小洋
 * Date：2025-06-26 10:41
 * Description：<描述>
 */
@Slf4j
@Controller
// @CrossOrigin
public class HelloController {

    // private static final Logger log = Logger.getLogger(HelloController.class.getName());

    @Autowired
    private Date date;

    @RequestMapping("/test1")
    @ResponseBody
    public String hello(){

        // MyUtil.print();
        log.info("执行了hello方法......");

        System.out.println(date);

        try{
            int i = 5/0;
            System.out.println(i);
        }catch(Exception e){
            log.error("程序出现异常:" + e.getMessage());
        }

        return "hello world";
    }
}
